cmake_minimum_required(VERSION 3.5.0)

# top project
project(CybertronLogApi VERSION 1.0.0 LANGUAGES C CXX)

#IF (UNIX)
#    set(CMAKE_C_COMPILER "/usr/bin/clang")
#    set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
#    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -I/usr/include/libcxxabi")
#    set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -stdlib=libc++ -lc++abi -rpath=./")
#    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#ENDIF()


#add_definitions(-DLOGAPI_EXPORTS)

if(UNIX)
  set (THREADS_PREFER_PTHREAD_FLAG ON)
  find_package(Threads REQUIRED)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()

#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/../../../Build/build/lib/Debug)
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/../../../Build/build/lib/Release)

#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG  ${PROJECT_SOURCE_DIR}/../../../Build/build/bin/Debug)
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/../../../Build/build/bin/Release)

#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/../../../Build/build/bin/Debug)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/../../../Build/build/bin/Release)

aux_source_directory(. DIR_SRCS)
aux_source_directory(../Common DIR_SRCS)

#ADD_LIBRARY  (CybertronLogApi SHARED ${DIR_SRCS})
#SetDefaultTargetProperties(CybertronLogApi)

ADD_LIBRARY  (CybertronLogApi STATIC ${DIR_SRCS})
SetDefaultTargetProperties(CybertronLogApi)

#if(WIN32)
#  target_link_libraries(CybertronLogApi wsock32 ws2_32)
#else()
#  target_link_libraries(CybertronLogApi PRIVATE Threads::Threads)
#endif()
IF (MSVC)
  SET_PROPERTY(TARGET CybertronLogApi PROPERTY FOLDER "Logger")
ENDIF()